import { generic } from './generic.js';
generic();
//获取图片
const imgs = [...document.querySelectorAll('.picture')];
//获取h1标签
const hAll = document.querySelector('.classification');
// ajax渲染图片
window.addEventListener('load', async () => {
  const { data } = await axios({
    // 请求地址
    url: 'http://website.bluej.cn/api/carouselGroup/get',
    // 请求方式
    method: 'GET',
    params: {
      carouselGroupId: '1368',
    },
  });
  const pictureAll = data.data.Carousels;
  console.log(pictureAll);
  for (let i = 0; i < pictureAll.length; i++) {
    imgs[i].innerHTML = `
    <img src="${pictureAll[i].url}" alt="" />
    `;
  }
});
hAll.addEventListener('click', function (e) {
  if (e.target.tagName === 'H1') {
    let p = e.target.nextElementSibling;
    p.classList.toggle('active');
    if (p.classList.contains('active')) {
      e.target.classList.remove('arrow-left');
      e.target.classList.add('arrow-down');
    } else {
      e.target.classList.remove('arrow-down');
      e.target.classList.add('arrow-left');
    }
  }
});
